package com.amex.uam.util;

import java.lang.reflect.Method;

public abstract class Bean {

	@Override
	public String toString() {
		StringBuffer buffer = new StringBuffer();
		try {
			Method[] ms = this.getClass().getDeclaredMethods();

			for (Method method : ms) {
				// System.out.println(method.getReturnType() + " " + method.getName()+"()");
				// System.out.println();
				
				if(method.getName().startsWith("get") && method.getName().length() > 3) {
					Object obj = method.invoke(this);
					String n = method.getName().substring(3);
					
					buffer.append("  ");
					buffer.append(n);
					buffer.append(':');
					buffer.append(obj);
					buffer.append('\n');
				}
			}
			//this.getClass().getDeclaredMethod("a2222", String.class, String.class);
			//Method m = this.getClass().getDeclaredMethod("setWORKFORCE_MBR_ID", String.class);
			//m.setAccessible(true); 
			//m.invoke(this);
		} catch (Exception e) {
			e.printStackTrace();
		}
		buffer.insert(0, this.getClass().getSimpleName() + " {\n").append("}");
		return buffer.toString();
	}
}
